package com.dpkit.adapter.database.mysql;

import com.dpkit.adapter.DatabaseDialect;
import com.dpkit.enums.FieldType;

public class MySqlDialect implements DatabaseDialect {
    @Override
    public String getTypeForField(FieldType fieldType, Integer length) {
        switch (fieldType) {
            case STRING:
                return length != null && length > 255 ? "TEXT" : "VARCHAR(" + length + ")";
            case LONG:
                return "BIGINT";
            case DATE:
                return "DATETIME";
            case BOOLEAN:
                return "TINYINT(1)";
            default:
                return "VARCHAR(255)";
        }
    }

    @Override
    public String handleSpecialSequence(String sequenceName) {
        return "";
    }

    @Override
    public String getLimitClause(int limit) {
        return "";
    }
}